#include <iostream>
#include <vector>
using namespace std;

//0 1 0 3 12
void moveZeroes(vector<int>& nums)
{
    int dest = -1;
    int cur = 0;
    while (cur != nums.size())
    {
        if (nums[cur] == 0)
        {
            cur++;
        }
        else
        {
            std::swap(nums[dest + 1], nums[cur]);
            dest++;
            cur++;
        }
    }
}
int main()
{
    vector<int> r = { 0,1,0,3,12 };
    moveZeroes(r);
    for (auto e : r)
    {
        cout << e << endl;
    }
}